//
// A Simple Game Engine
//
// Copyright 2009 CG & CAD Institute, Tsinghua University.
// All rights reserved.
//

#include "../src/gameengine.h"

// CppUnit headers
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
#include <cppunit/ui/text/TestRunner.h>
#include <cppunit/CompilerOutputter.h>

// C++ headers
#include <string>

// C headers
//#include <stdio.h>

// User headers
//#include "my_header.h"

namespace engine
{

namespace test
{

class GameEngineTest : public CppUnit::TestFixture
{
    CPPUNIT_TEST_SUITE(GameEngineTest);

    // Test cases
    //CPPUNIT_TEST(testSample);

    CPPUNIT_TEST_SUITE_END();

// public type forward-declarations & typedefs & defs
public:

// public constructors & destructor
public:
    GameEngineTest(void);
    virtual ~GameEngineTest(void);

// setUp & tearDown
public:
    virtual void setUp(void);
    virtual void tearDown(void);

// test cases
private:
    //void testSample(void);

// public member functions
public:

// public static member functions
public:

// protected type forward-declarations & typedefs & defs
protected:

// protected member functions
protected:

// protected static member functions
protected:

// private type forward-declarations & typedefs & defs
private:

// private member functions
private:

// private static member functions
private:

// private data members
private:

// protected constructors & destructor
protected:

// private constructors & destructor
private:
    // Disable the evil constructor and assignment operator.
    GameEngineTest(const GameEngineTest&);
    GameEngineTest& operator=(const GameEngineTest&);
};

CPPUNIT_TEST_SUITE_REGISTRATION(GameEngineTest);

GameEngineTest::GameEngineTest(void)
{
}

GameEngineTest::~GameEngineTest(void)
{
}

void GameEngineTest::setUp(void)
{
}

void GameEngineTest::tearDown(void)
{
}

//void GameEngineTest::testSample(void)
//{
//    CPPUNIT_ASSERT(condition);
//    CPPUNIT_FAIL(message);
//    CPPUNIT_ASSERT_EQUAL(expected, actual);
//    CPPUNIT_ASSERT_EQUAL_MESSAGE(message, expected, actual);
//    CPPUNIT_ASSERT_DOUBLES_EQUAL(expected, actual, delta);
//    CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(message, expected, actual, delta);
//}

} // namespace test

} // namespace engine

int main(int argc, char* argv[])
{
    CppUnit::TextUi::TestRunner runner;
    std::string format = CPPUNIT_COMPILER_LOCATION_FORMAT;
    size_t state = 0;
    for (std::string::size_type i = 0; i < format.size(); ++i)
    {
        if (state == 0 &&format[i] == '%')
        {
            state = 1;
        }
        else
        {
            if (format[i] == 'f')
                format[i] = 'p';
            state = 0;
        }
    }
    CppUnit::CompilerOutputter* outputter =
        new CppUnit::CompilerOutputter(&runner.result(),
                                       std::cout,
                                       format.c_str());
    runner.setOutputter(outputter);
    CppUnit::TestSuite* suite = new CppUnit::TestSuite();
    CppUnit::TestFactoryRegistry& registry =
        CppUnit::TestFactoryRegistry::getRegistry();
    runner.addTest(registry.makeTest());
    runner.addTest(suite);
    return runner.run("", false) ? 0 : 1;
}
